package com.learn.smart.framework.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class StreamUtil {
	
	private static final Logger log = LoggerFactory.getLogger(StreamUtil.class);
	
	public static String getString(InputStream is){
		StringBuilder sb = new StringBuilder();
		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
		String line;
		try {
			while((line=reader.readLine())!=null){
				sb.append(line);
			}
		} catch (IOException e) {
			log.error("读取流失败",e);
			e.printStackTrace();
		}
		return sb.toString();
	}
	

}
